<?php
namespace app\admin\controller;

use think\Controller;

class GitController extends Controller
{
    public function index()
    {
        echo 'test';
    }

    public function pull()
    {
        header("Content-type: text/html; charset=utf-8");
        $psd = $this->request->param('password');
        if ($psd != config('gitoschina.psd')) {
            die("ERROR!"); // 判断密码
        }
        exec("cd /home/wwwroot/app.rootcloud.com"); // 进入目录
        exec("sudo git pull origin master"); // 进行git拉取，前提是使用了ssh
        echo "OK";
    }
}
